package com.cmcc.aregister.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery.LayoutParams;
import android.widget.ImageView;

import com.cmcc.aregister.R;

public class AdImageAdapter extends BaseAdapter {
	private Context context;
	private int[] bg = { R.drawable.ad_default_1, R.drawable.ad_default_2,
			R.drawable.ad_default_3, R.drawable.ad_default_4 };

	public AdImageAdapter(Context context) {
		this.context = context;
	}

	public int getCount() {
		return bg.length;
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView image = new ImageView(context);
		image.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT));
		image.setBackgroundResource(bg[position]);
		return image;
	}
}